#ifndef _TAN_ERROR_H_
#define _TAN_ERROR_H_

#include "stdio.h"
#include <assert.h>

#ifdef NDEBUG
#define tan_assert(expression) ((void*)expression)
#else
#define tan_assert(expression, msg) Tan_printSystemError((TAN_INT32)expression, msg, __FILE__, (TAN_UINT32)__LINE__)
#endif // !NDEBUG

#define tan_crash *((int*)0)

static void* Tan_printSystemError(int _if, const TAN_INT8* msg, const TAN_INT8* file, int line)
{
	if (_if > 0) return (void*)0x1;
	
	TAN_INT8 buffer[1024] = { 0 };
	printf("system error:[%s:%d]: %s", file, line, msg);
	tan_crash;
	return (void*)0;
}

#endif